project(simple_atlas_texture_generator)

cmake_minimum_required(VERSION 2.6)

set(EXECUTABLE_NAME Atlas_Texture_Generator)

MESSAGE(${PROJECT_SOURCE_DIR})

#We need Qt4 to build this project
find_package(Qt4 REQUIRED)

#set(Boost_USE_STATIC_LIBS        ON)
#set(Boost_USE_MULTITHREADED      ON)
#set(Boost_USE_STATIC_RUNTIME    OFF)
set(Boost_INCLUDE_DIR /Users/thomas/boost_1_47_0/)
#set(Boost_LIBRARY_DIRS /Users/thomas/boost_1_47_0/libs)

find_package(Boost COMPONENTS thread REQUIRED)


#enable the Qt XML libraries
set(QT_USE_QTXML TRUE)
#include all enabled Qt libraries
include(${QT_USE_FILE})

MESSAGE(${Boost_INCLUDE_DIR})
include_directories(${Boost_INCLUDE_DIR})
include_directories(${Boost_INCLUDE_DIR}/boost)

IF(Boost_THREAD_FOUND)
MESSAGE("The Boost::thread library has been found")
ENDIF()

MESSAGE("${Boost_ERROR_REASON}")


add_subdirectory(src)

set(SRCS ${PROJECT_SOURCE_DIR}/src/Controller.h ${PROJECT_SOURCE_DIR}/src/Controller.cpp ${PROJECT_SOURCE_DIR}/src/ImageHandler.h ${PROJECT_SOURCE_DIR}/src/ImageHandler.cpp)

set(PROCESS_SRCS ${PROJECT_SOURCE_DIR}/src/Controller.h)


#compile all necessary files with the MOC
#~ALSO~ pass a variable to store the paths to the processed files
qt4_wrap_cpp(MOC_PROCESSED_FILES ${PROCESS_SRCS})


add_subdirectory(lib)

add_executable(Atlas_Texture_Generator  ${SRCS} ${PROCESS_SRCS})


IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
  target_link_libraries(Atlas_Texture_Generator ${PROJECT_SOURCE_DIR}/lib/libosx_boost_thread.dylib)
   SET(OperatingSystem "Mac OS X")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")

IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
	target_link_libraries(Atlas_Texture_Generator ${PROJECT_SOURCE_DIR}/lib/liblinux_boost_thread.so.1.47.0)
    SET(OperatingSystem "Linux")
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux")


target_link_libraries(Atlas_Texture_Generator ${QT_LIBRARIES})
#target_link_libraries(Atlas_Texture_Generator ${Boost_LIBRARIES})
#target_link_libraries(Atlas_Texture_Generator ${Boost_THREAD_LIBRARY})

MESSAGE(${OperatingSystem})